<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>JS的字符串</title>
</head>
<body>
<script>
    // 字符串创建方式一: let 变量名 = new String(s);
    let str1 = new String("abc");
    document.write(str1 + "<br/>");

    //字符串创建方式二: let 变量名 = "内容";
    let str2 = "hello";
    document.write(str2 + "<br/>");

    // 字符串的长度: length属性
    document.write(str2.length + "<br/>");

    // trim(): 去除字符串前后两端的空白字符 (密码)
    var str4 = '  ab  c   ';
    document.write(1 + str4.trim() + 1);
</script>
</body>
</html>